package scauCmiScaffolding.compiled;

import org.eclipse.jet.JET2Context;
import org.eclipse.jet.JET2Template;
import org.eclipse.jet.JET2Writer;
import org.eclipse.jet.taglib.RuntimeTagElement;
import org.eclipse.jet.taglib.TagInfo;

public class _jet_cmiPsonService_0 implements JET2Template {
    private static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$

    public _jet_cmiPsonService_0() {
        super();
    }

    private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
    
    private static final TagInfo _td_c_get_1_9 = new TagInfo("c:get", //$NON-NLS-1$
            1, 9,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$packageName", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_15_8 = new TagInfo("c:get", //$NON-NLS-1$
            15, 8,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$packageName", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_16_8 = new TagInfo("c:get", //$NON-NLS-1$
            16, 8,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$packageName", //$NON-NLS-1$
            } );
    private static final TagInfo _td_c_get_17_8 = new TagInfo("c:get", //$NON-NLS-1$
            17, 8,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$packageName", //$NON-NLS-1$
            } );

    public void generate(final JET2Context context, final JET2Writer __out) {
        JET2Writer out = __out;
        out.write("package ");  //$NON-NLS-1$        
        RuntimeTagElement _jettag_c_get_1_9 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_1_9); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_c_get_1_9.setRuntimeParent(null);
        _jettag_c_get_1_9.setTagInfo(_td_c_get_1_9);
        _jettag_c_get_1_9.doStart(context, out);
        _jettag_c_get_1_9.doEnd();
        out.write(".base.service;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("import java.lang.reflect.Array;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.lang.reflect.Field;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.lang.reflect.Type;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.Collection;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.Iterator;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.Map;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.Map.Entry;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.function.Consumer;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import org.springframework.stereotype.Component;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import com.alibaba.fastjson.JSONObject;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import com.google.gson.Gson;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("import ");  //$NON-NLS-1$        
        RuntimeTagElement _jettag_c_get_15_8 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_15_8); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_c_get_15_8.setRuntimeParent(null);
        _jettag_c_get_15_8.setTagInfo(_td_c_get_15_8);
        _jettag_c_get_15_8.doStart(context, out);
        _jettag_c_get_15_8.doEnd();
        out.write(".base.bean.CmiAttributePagination;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import ");  //$NON-NLS-1$        
        RuntimeTagElement _jettag_c_get_16_8 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_16_8); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_c_get_16_8.setRuntimeParent(null);
        _jettag_c_get_16_8.setTagInfo(_td_c_get_16_8);
        _jettag_c_get_16_8.doStart(context, out);
        _jettag_c_get_16_8.doEnd();
        out.write(".util.CmiHibernateProxyUtil;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import ");  //$NON-NLS-1$        
        RuntimeTagElement _jettag_c_get_17_8 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_17_8); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_c_get_17_8.setRuntimeParent(null);
        _jettag_c_get_17_8.setTagInfo(_td_c_get_17_8);
        _jettag_c_get_17_8.doStart(context, out);
        _jettag_c_get_17_8.doEnd();
        out.write(".base.bean.*;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write(NL);         
        out.write("@Component");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("public class CmiPsonService {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("//    public enum Flag {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        FIRST, SECOND, THIRD;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("    private int realPsonDepth;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    private int psonDepth = 1;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    private int defaultPsonDepth = 2;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//    private int recursiveDepth = 1; // 1:第一次， 2:第二次， 3:第三次或以上");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    private boolean isCollection;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    private String tempKey;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    private CmiPagination mySubPagination;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("//    private Flag decFlag(Flag flag) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        if (flag.equals(Flag.THIRD)) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            return Flag.SECOND;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        if (flag.equals(Flag.SECOND)) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            return Flag.FIRST;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        return Flag.FIRST;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("    public Object fromJson(String json, Type tpeOff) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        return new Gson().fromJson(json, tpeOff);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("    public <T> T fromJson(String json, Class<T> classOfT) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        return new Gson().fromJson(json, classOfT);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("//    ！！！！！从CmiPson复制过来！！！！！！");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//  普通的的tojson方法，");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//    主要用于restController中，最开始的方法，这个方法只在本类被使用？？？");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    public String toJson(Object object) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        return toJsonContinue(object, psonDepth);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    public String toJson(Object object, int depth) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        StringBuilder stringBuilder = new StringBuilder();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        stringBuilder.append(toJsonContinue(object, depth));");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("    //  带分页的tojson方法，主要用于restController中");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    public String toJson(Object object, CmiPagination cmiPagination) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    \treturn toJson(object, defaultPsonDepth, cmiPagination);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    public String toJson(Object object, int depth, CmiPagination cmiPagination) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    \t//        recursiveDepth = 1;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        this.realPsonDepth = depth;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        isCollection = object instanceof Collection<?> ? true : false;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("        // 获取分页结果");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        cmiPagination.setPagination(object);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("        mySubPagination = cmiPagination;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("        StringBuilder stringBuilder = new StringBuilder();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        stringBuilder.append(\"{\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        stringBuilder.append(\"\\\"page\\\":\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        stringBuilder.append(JSONObject.toJSONString(cmiPagination));");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        stringBuilder.append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        stringBuilder.append(\"\\\"data\\\":\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        stringBuilder.append(toJsonContinue(object, depth, cmiPagination));");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        stringBuilder.append(\"}\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        System.out.println(stringBuilder.toString());");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    private String toJsonContinue(Object object, int depth) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        StringBuilder stringBuilder = new StringBuilder();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        if (object == null) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            return null;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        } else if (object instanceof Collection<?>) { // Collection集合类型");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"[\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            @SuppressWarnings(\"unchecked\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            Collection<Object> objCollection = (Collection<Object>) object;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            objCollection.forEach(new Consumer<Object>() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                public void accept(Object subObject) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    stringBuilder.append(toJsonContinue(subObject, depth)).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    System.out.println(\"Collection-->>\"+stringBuilder.toString());");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                };");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            });");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            if (stringBuilder.length() > 1) { // 去掉最后一个 ,");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"]\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        } else if (object.getClass().isArray()) { // Array数组类型");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"[\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            for (int i = 0; i < Array.getLength(object); i++) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.append(toJsonContinue(Array.get(object, i), depth)).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            if (stringBuilder.length() > 1) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"]\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        } else if (object instanceof Map) { // Map类型");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"[{\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            @SuppressWarnings(\"unchecked\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            Map<Object, Object> map = (Map<Object, Object>) object;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            Iterator<Map.Entry<Object, Object>> mapIterator = map.entrySet().iterator();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            while (mapIterator.hasNext()) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                Entry<Object, Object> current = mapIterator.next();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.append(\"\\\"\").append(current.getKey()).append(\"\\\"\").append(\":\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        .append(toJson(current.getValue())).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            if (stringBuilder.length() > 1) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"}]\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        } else if (object.getClass().getName().startsWith(\"java\")) { // Java JDK 自带 非集合 类实例");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            return new Gson().toJson(object);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        } else { // 用户自建类实例");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            object = CmiHibernateProxyUtil.deproxy(object);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"{\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            Field[] fields = object.getClass().getDeclaredFields();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            Field.setAccessible(fields, true);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            for (Field field : fields) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                String fieldName = field.getName();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                Object fieldObject = null;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                try {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    fieldObject = field.get(object);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                } catch (IllegalArgumentException | IllegalAccessException e) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    // TODO Auto-generated catch block");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    e.printStackTrace();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                // 控制第Flag层的数据显示，只显示第Flag层的基本属性，集合属性以及引用属性不显示");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                if (depth > 1");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        || (fieldObject != null) && !(fieldObject instanceof Collection<?>)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                                && fieldObject.getClass().getName().startsWith(\"java\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        || (fieldObject != null) && !(fieldObject instanceof Collection<?>)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                                && fieldObject.getClass().isArray()) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    String fieldJsonString = toJsonContinue(fieldObject, depth - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    if (fieldJsonString != null) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        stringBuilder.append(\"\\\"\").append(fieldName).append(\"\\\"\").append(\":\").append(fieldJsonString)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                                .append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            if (stringBuilder.length() > 1) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"}\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    /**");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * 1. controller 包装好page，封装到object，psonutil只管使用 问题：object为集合时，page放置问题");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * 思路：把page里的paginationSize beginPagination currentPagination totalPaginations");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * totalRecords设置成静态变量，所有实体类共用，更新page时只需要更新一次");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * 带来问题：如果controller同时被访问，而page只有一个，有可能会导致page数据错乱 2. controller 未包装page,");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * psonutil更新page，再把page封装到json数据中 问题：访问的当前页无法确定 3. controller");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * 包装好page，不封装到object，让page作为第三个参数传进toJson()，psonutil把page封装到返回数据中");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * 问题：返回json数据格式未确定 思路1. page整合到每一个返回的实体类中 思路2. page与返回集合同层次 4. controller");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * 包装好page的当前页信息，传进psonutil，psonutil根据page的当前页进行分页，最后把page封装到返回数据l中");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * 集合： 第一次：使用MyPage成员对集合分页，标记为2 第二次：使用MyPage中的attribute对集合进行分页，标记为3 第三次：操作不变");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * java自带： 第一次：标记为2，操作不变 第二次： 第三次： 自定义： 第一次：标记为2，操作不变 第二次： 第三次：");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * 集合：true 只对当前集合元素分页，集合元素子元素不分页 单体：false 对子元素分页");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * @param object");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * @param depth");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     * @return");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("     */");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    private String toJsonContinue(Object object, int depth, CmiPagination cmiPagination) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        StringBuilder stringBuilder = new StringBuilder();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        if (object == null) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            return null;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        } else if (object instanceof Collection<?>) { // Collection集合类型");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("            stringBuilder.append(\"[\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            @SuppressWarnings(\"unchecked\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            Collection<Object> objCollection = (Collection<Object>) object;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("            int startIndex = 0;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            int endIndex = 0;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("            switch (this.realPsonDepth - depth) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                case 0:");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    this.recursiveDepth = 2;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("                    Object[] array = objCollection.toArray();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    startIndex = cmiPagination.getPaginationSize() * (cmiPagination.getCurrentPagination() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    endIndex = startIndex + cmiPagination.getPaginationSize() > cmiPagination.getTotalRecords() ? cmiPagination.getTotalRecords()");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                            : startIndex + cmiPagination.getPaginationSize();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    for (int i = startIndex; i < endIndex; i++) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        Object subObject = array[i];");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("                        // 每个单体元素的page");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        mySubPagination = new CmiPagination(subObject);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("                        stringBuilder.append(toJsonContinue(subObject, depth, cmiPagination)).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("                        // TODO 上面depth层数没有降下来，用isCollection修补");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("//                        this.recursiveDepth = 2;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("                    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    break;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("                case 1:");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    this.recursiveDepth = 3;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("//                    if (false) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                        objCollection.forEach(new Consumer<Object>() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                            @Override");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                            public void accept(Object t) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                                stringBuilder.append(toJsonContinue(t, depth, myPage)).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                        });");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    } else {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    // TODO tempKey");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    CmiAttributePagination cmiAttributePagination = isCollection ? mySubPagination.getAttributeMap().get(tempKey)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                            : cmiPagination.getAttributeMap().get(tempKey);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    System.out.println(tempKey);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    Object[] attributeArray = objCollection.toArray();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    startIndex = cmiAttributePagination.getPageSize() * (cmiAttributePagination.getCurrentPagination() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    endIndex = startIndex + cmiAttributePagination.getPageSize() > cmiAttributePagination.getTotalRecords()");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                            ? cmiAttributePagination.getTotalRecords()");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                            : startIndex + cmiAttributePagination.getPageSize();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    System.out.println(startIndex + \"  \" + endIndex);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    for (int i = startIndex; i < endIndex; i++) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        Object attributeSubObject = attributeArray[i];");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        stringBuilder.append(toJsonContinue(attributeSubObject, depth, cmiPagination)).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    break;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("                default:");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    objCollection.forEach(new Consumer<Object>() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        @Override");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        public void accept(Object t) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                            stringBuilder.append(toJsonContinue(t, depth, cmiPagination)).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    });");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    break;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("            if (stringBuilder.length() > 1) { // 去掉最后一个 ,");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"]\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        } else if (object.getClass().isArray()) { // Array数组类型");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"[\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            for (int i = 0; i < Array.getLength(object); i++) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                stringBuilder.append(toJsonContinue(Array.get(object, i), depth)).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            if (stringBuilder.length() > 1) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"]\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        } else if (object instanceof Map) { // Map类型");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"[{\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            @SuppressWarnings(\"unchecked\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            Map<Object, Object> map = (Map<Object, Object>) object;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            Iterator<Map.Entry<Object, Object>> mapIterator = map.entrySet().iterator();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            while (mapIterator.hasNext()) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                Entry<Object, Object> current = mapIterator.next();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                stringBuilder.append(\"\\\"\").append(current.getKey()).append(\"\\\"\").append(\":\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                        .append(toJson(current.getValue())).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            if (stringBuilder.length() > 1) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"}]\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        } else if (object.getClass().getName().startsWith(\"java\")) { // Java JDK 自带 非集合 类实例");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            return new Gson().toJson(object);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        } else { // 用户自建类实例");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            if (recursiveDepth == 1)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                recursiveDepth = 2;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            object = CmiHibernateProxyUtil.deproxy(object);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"{\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            if (this.realPsonDepth == depth) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.append(\"\\\"page\\\":\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.append(JSONObject.toJSONString(mySubPagination));");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            Field[] fields = object.getClass().getDeclaredFields();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            Field.setAccessible(fields, true);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            for (Field field : fields) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                String fieldName = field.getName();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                this.tempKey = fieldName;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                Object fieldObject = null;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                try {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    fieldObject = field.get(object);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                } catch (IllegalArgumentException | IllegalAccessException e) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    // TODO Auto-generated catch block");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    e.printStackTrace();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                // 控制第Flag层的数据显示，只显示第Flag层的基本属性，集合属性以及引用属性不显示");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                if (depth > 1");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        || (fieldObject != null) && !(fieldObject instanceof Collection<?>)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                                && fieldObject.getClass().getName().startsWith(\"java\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        || (fieldObject != null) && !(fieldObject instanceof Collection<?>)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                                && fieldObject.getClass().isArray()) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    String fieldJsonString = toJsonContinue(fieldObject, depth - 1, cmiPagination);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    if (fieldJsonString != null) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                        stringBuilder.append(\"\\\"\").append(fieldName).append(\"\\\"\").append(\":\").append(fieldJsonString)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                                .append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            if (stringBuilder.length() > 1) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            stringBuilder.append(\"}\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("        return null;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("//    public String toJsonContinue(Object object, int depth) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        StringBuilder stringBuilder = new StringBuilder();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        if (object == null) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            return null;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        } else if (object instanceof Collection<?>) { // Collection集合类型");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"[\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            @SuppressWarnings(\"unchecked\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            Collection<Object> objCollection = (Collection<Object>) object;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            Iterator<Object> iterator = objCollection.iterator();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            if (iterator.hasNext()) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                Object next = iterator.next();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                System.out.println(next.getClass().getName());");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            objCollection.forEach(new Consumer<Object>() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                public void accept(Object subObject) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    stringBuilder.append(toJsonContinue(subObject, depth)).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                };");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            });");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            if (stringBuilder.length() > 1) { // 去掉最后一个 ,");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"]\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        } else if (object.getClass().isArray()) { // Array数组类型");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"[\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            for (int i = 0; i < Array.getLength(object); i++) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                stringBuilder.append(toJsonContinue(Array.get(object, i), depth)).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            if (stringBuilder.length() > 1) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"]\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        } else if (object instanceof Map) { // Map类型");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"[{\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            @SuppressWarnings(\"unchecked\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            Map<Object, Object> map = (Map<Object, Object>) object;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            Iterator<Map.Entry<Object, Object>> mapIterator = map.entrySet().iterator();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            while (mapIterator.hasNext()) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                Entry<Object, Object> current = mapIterator.next();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                stringBuilder.append(\"\\\"\").append(current.getKey()).append(\"\\\"\").append(\":\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                        .append(toJson(current.getValue())).append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            if (stringBuilder.length() > 1) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"}]\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        } else if (object.getClass().getName().startsWith(\"java\")) { // Java JDK 自带 非集合 类实例");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            return new Gson().toJson(object);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        } else { // 用户自建类实例");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            object = CmiHibernateProxyUtil.deproxy(object);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"{\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            Field[] fields = object.getClass().getDeclaredFields();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            Field.setAccessible(fields, true);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            for (Field field : fields) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                String fieldName = field.getName();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                Object fieldObject = null;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                try {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    fieldObject = field.get(object);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                } catch (IllegalArgumentException | IllegalAccessException e) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    // TODO Auto-generated catch block");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    e.printStackTrace();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                // 控制第Flag层的数据显示，只显示第Flag层的基本属性，集合属性以及引用属性不显示");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                if (depth > 1");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                        || (fieldObject != null) && !(fieldObject instanceof Collection<?>)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                                && fieldObject.getClass().getName().startsWith(\"java\")");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                        || (fieldObject != null) && !(fieldObject instanceof Collection<?>)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                                && fieldObject.getClass().isArray()) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    String fieldJsonString = toJsonContinue(fieldObject, depth - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    if (fieldJsonString != null) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                        stringBuilder.append(\"\\\"\").append(fieldName).append(\"\\\"\").append(\":\").append(fieldJsonString)");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                                .append(\",\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            if (stringBuilder.length() > 1) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//                stringBuilder.deleteCharAt(stringBuilder.length() - 1);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            stringBuilder.append(\"}\");");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//            return stringBuilder.toString();");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//        }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("//    }");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("}");  //$NON-NLS-1$        
    }
}
